<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="唯一值id" prop="cgjgId">
        <el-input
          v-model="queryParams.cgjgId"
          placeholder="请输入唯一值id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="订单日期" prop="orderDate">
        <el-date-picker clearable
          v-model="queryParams.orderDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择订单日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="订单编码" prop="orderCode">
        <el-input
          v-model="queryParams.orderCode"
          placeholder="请输入订单编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="采购需求" prop="purchaseRequirement">
        <el-input
          v-model="queryParams.purchaseRequirement"
          placeholder="请输入采购需求"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料编码" prop="materialCode">
        <el-input
          v-model="queryParams.materialCode"
          placeholder="请输入物料编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料名称" prop="materialName">
        <el-input
          v-model="queryParams.materialName"
          placeholder="请输入物料名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料类型" prop="materialType">
        <el-select v-model="queryParams.materialType" placeholder="请选择物料类型" clearable>
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="物料属性" prop="materialAttribute">
        <el-input
          v-model="queryParams.materialAttribute"
          placeholder="请输入物料属性"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="规格型号" prop="specificationModel">
        <el-input
          v-model="queryParams.specificationModel"
          placeholder="请输入规格型号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="采购单价" prop="purchaseUnitPrice">
        <el-input
          v-model="queryParams.purchaseUnitPrice"
          placeholder="请输入采购单价"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="已入库数量" prop="inboundQuantity">
        <el-input
          v-model="queryParams.inboundQuantity"
          placeholder="请输入已入库数量"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="采购数量需求" prop="purchaseRequirementQty">
        <el-input
          v-model="queryParams.purchaseRequirementQty"
          placeholder="请输入采购数量需求"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单位" prop="unit">
        <el-input
          v-model="queryParams.unit"
          placeholder="请输入单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="开票金额" prop="invoiceAmount">
        <el-input
          v-model="queryParams.invoiceAmount"
          placeholder="请输入开票金额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="税费" prop="taxAmount">
        <el-input
          v-model="queryParams.taxAmount"
          placeholder="请输入税费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="运费" prop="freightCost">
        <el-input
          v-model="queryParams.freightCost"
          placeholder="请输入运费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="采购需求金额" prop="purchaseRequirementAmt">
        <el-input
          v-model="queryParams.purchaseRequirementAmt"
          placeholder="请输入采购需求金额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="实际应付金额" prop="actualPayableAmount">
        <el-input
          v-model="queryParams.actualPayableAmount"
          placeholder="请输入实际应付金额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="已付金额" prop="paidAmount">
        <el-input
          v-model="queryParams.paidAmount"
          placeholder="请输入已付金额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="退货数量" prop="returnQuantity">
        <el-input
          v-model="queryParams.returnQuantity"
          placeholder="请输入退货数量"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="退款金额" prop="refundAmount">
        <el-input
          v-model="queryParams.refundAmount"
          placeholder="请输入退款金额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单箱" prop="itemsPerBox">
        <el-input
          v-model="queryParams.itemsPerBox"
          placeholder="请输入单箱"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单位换算率" prop="unitConversionRate">
        <el-input
          v-model="queryParams.unitConversionRate"
          placeholder="请输入单位换算率"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="采购件数" prop="purchaseUnits">
        <el-input
          v-model="queryParams.purchaseUnits"
          placeholder="请输入采购件数"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="采购单位" prop="purchaseUnit">
        <el-input
          v-model="queryParams.purchaseUnit"
          placeholder="请输入采购单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最小单价(ml/g)" prop="minUnitPriceMlG">
        <el-input
          v-model="queryParams.minUnitPriceMlG"
          placeholder="请输入最小单价(ml/g)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单位" prop="unit2">
        <el-input
          v-model="queryParams.unit2"
          placeholder="请输入单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="供应商编码" prop="supplierCode">
        <el-input
          v-model="queryParams.supplierCode"
          placeholder="请输入供应商编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="供应商名称" prop="supplierName">
        <el-input
          v-model="queryParams.supplierName"
          placeholder="请输入供应商名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="付款状态" prop="paymentStatus">
        <el-select v-model="queryParams.paymentStatus" placeholder="请选择付款状态" clearable>
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="入库时间" prop="inboundTime">
        <el-date-picker clearable
          v-model="queryParams.inboundTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择入库时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="退货/款时间" prop="returnRefundTime">
        <el-date-picker clearable
          v-model="queryParams.returnRefundTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择退货/款时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['md:price:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['md:price:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['md:price:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
            type="success"
            plain
            icon="el-icon-refresh"
            size="mini"
            @click="handleSync"
            v-hasPermi="['md:price:order:sync']"
        >数据同步</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['md:price:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="priceList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="主键ID" align="center" prop="id" />
      <el-table-column label="唯一值id" align="center" prop="cgjgId" />
      <el-table-column label="订单日期" align="center" prop="orderDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.orderDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="订单编码" align="center" prop="orderCode" />
      <el-table-column label="采购需求" align="center" prop="purchaseRequirement" />
      <el-table-column label="物料编码" align="center" prop="materialCode" />
      <el-table-column label="物料名称" align="center" prop="materialName" />
      <el-table-column label="物料类型" align="center" prop="materialType" />
      <el-table-column label="物料属性" align="center" prop="materialAttribute" />
      <el-table-column label="规格型号" align="center" prop="specificationModel" />
      <el-table-column label="采购单价" align="center" prop="purchaseUnitPrice" />
      <el-table-column label="已入库数量" align="center" prop="inboundQuantity" />
      <el-table-column label="采购数量需求" align="center" prop="purchaseRequirementQty" />
      <el-table-column label="单位" align="center" prop="unit" />
      <el-table-column label="开票金额" align="center" prop="invoiceAmount" />
      <el-table-column label="税费" align="center" prop="taxAmount" />
      <el-table-column label="运费" align="center" prop="freightCost" />
      <el-table-column label="采购需求金额" align="center" prop="purchaseRequirementAmt" />
      <el-table-column label="实际应付金额" align="center" prop="actualPayableAmount" />
      <el-table-column label="已付金额" align="center" prop="paidAmount" />
      <el-table-column label="退货数量" align="center" prop="returnQuantity" />
      <el-table-column label="退款金额" align="center" prop="refundAmount" />
      <el-table-column label="单箱" align="center" prop="itemsPerBox" />
      <el-table-column label="单位换算率" align="center" prop="unitConversionRate" />
      <el-table-column label="采购件数" align="center" prop="purchaseUnits" />
      <el-table-column label="采购单位" align="center" prop="purchaseUnit" />
      <el-table-column label="备注" align="center" prop="remarks" />
      <el-table-column label="最小单价(ml/g)" align="center" prop="minUnitPriceMlG" />
      <el-table-column label="单位" align="center" prop="unit2" />
      <el-table-column label="供应商编码" align="center" prop="supplierCode" />
      <el-table-column label="供应商名称" align="center" prop="supplierName" />
      <el-table-column label="付款状态" align="center" prop="paymentStatus" />
      <el-table-column label="入库时间" align="center" prop="inboundTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.inboundTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="退货/款时间" align="center" prop="returnRefundTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.returnRefundTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="状态" align="center" prop="status" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['md:price:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['md:price:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改采购订单实际入库价格数据流对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="唯一值id" prop="cgjgId">
          <el-input v-model="form.cgjgId" placeholder="请输入唯一值id" />
        </el-form-item>
        <el-form-item label="订单日期" prop="orderDate">
          <el-date-picker clearable
            v-model="form.orderDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择订单日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="订单编码" prop="orderCode">
          <el-input v-model="form.orderCode" placeholder="请输入订单编码" />
        </el-form-item>
        <el-form-item label="采购需求" prop="purchaseRequirement">
          <el-input v-model="form.purchaseRequirement" placeholder="请输入采购需求" />
        </el-form-item>
        <el-form-item label="物料编码" prop="materialCode">
          <el-input v-model="form.materialCode" placeholder="请输入物料编码" />
        </el-form-item>
        <el-form-item label="物料名称" prop="materialName">
          <el-input v-model="form.materialName" placeholder="请输入物料名称" />
        </el-form-item>
        <el-form-item label="物料类型" prop="materialType">
          <el-select v-model="form.materialType" placeholder="请选择物料类型">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="物料属性" prop="materialAttribute">
          <el-input v-model="form.materialAttribute" placeholder="请输入物料属性" />
        </el-form-item>
        <el-form-item label="规格型号" prop="specificationModel">
          <el-input v-model="form.specificationModel" placeholder="请输入规格型号" />
        </el-form-item>
        <el-form-item label="采购单价" prop="purchaseUnitPrice">
          <el-input v-model="form.purchaseUnitPrice" placeholder="请输入采购单价" />
        </el-form-item>
        <el-form-item label="已入库数量" prop="inboundQuantity">
          <el-input v-model="form.inboundQuantity" placeholder="请输入已入库数量" />
        </el-form-item>
        <el-form-item label="采购数量需求" prop="purchaseRequirementQty">
          <el-input v-model="form.purchaseRequirementQty" placeholder="请输入采购数量需求" />
        </el-form-item>
        <el-form-item label="单位" prop="unit">
          <el-input v-model="form.unit" placeholder="请输入单位" />
        </el-form-item>
        <el-form-item label="开票金额" prop="invoiceAmount">
          <el-input v-model="form.invoiceAmount" placeholder="请输入开票金额" />
        </el-form-item>
        <el-form-item label="税费" prop="taxAmount">
          <el-input v-model="form.taxAmount" placeholder="请输入税费" />
        </el-form-item>
        <el-form-item label="运费" prop="freightCost">
          <el-input v-model="form.freightCost" placeholder="请输入运费" />
        </el-form-item>
        <el-form-item label="采购需求金额" prop="purchaseRequirementAmt">
          <el-input v-model="form.purchaseRequirementAmt" placeholder="请输入采购需求金额" />
        </el-form-item>
        <el-form-item label="实际应付金额" prop="actualPayableAmount">
          <el-input v-model="form.actualPayableAmount" placeholder="请输入实际应付金额" />
        </el-form-item>
        <el-form-item label="已付金额" prop="paidAmount">
          <el-input v-model="form.paidAmount" placeholder="请输入已付金额" />
        </el-form-item>
        <el-form-item label="退货数量" prop="returnQuantity">
          <el-input v-model="form.returnQuantity" placeholder="请输入退货数量" />
        </el-form-item>
        <el-form-item label="退款金额" prop="refundAmount">
          <el-input v-model="form.refundAmount" placeholder="请输入退款金额" />
        </el-form-item>
        <el-form-item label="单箱" prop="itemsPerBox">
          <el-input v-model="form.itemsPerBox" placeholder="请输入单箱" />
        </el-form-item>
        <el-form-item label="单位换算率" prop="unitConversionRate">
          <el-input v-model="form.unitConversionRate" placeholder="请输入单位换算率" />
        </el-form-item>
        <el-form-item label="采购件数" prop="purchaseUnits">
          <el-input v-model="form.purchaseUnits" placeholder="请输入采购件数" />
        </el-form-item>
        <el-form-item label="采购单位" prop="purchaseUnit">
          <el-input v-model="form.purchaseUnit" placeholder="请输入采购单位" />
        </el-form-item>
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="最小单价(ml/g)" prop="minUnitPriceMlG">
          <el-input v-model="form.minUnitPriceMlG" placeholder="请输入最小单价(ml/g)" />
        </el-form-item>
        <el-form-item label="单位" prop="unit2">
          <el-input v-model="form.unit2" placeholder="请输入单位" />
        </el-form-item>
        <el-form-item label="供应商编码" prop="supplierCode">
          <el-input v-model="form.supplierCode" placeholder="请输入供应商编码" />
        </el-form-item>
        <el-form-item label="供应商名称" prop="supplierName">
          <el-input v-model="form.supplierName" placeholder="请输入供应商名称" />
        </el-form-item>
        <el-form-item label="付款状态">
          <el-radio-group v-model="form.paymentStatus">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="入库时间" prop="inboundTime">
          <el-date-picker clearable
            v-model="form.inboundTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择入库时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="退货/款时间" prop="returnRefundTime">
          <el-date-picker clearable
            v-model="form.returnRefundTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择退货/款时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="状态">
          <el-radio-group v-model="form.status">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="删除标志" prop="delFlag">
          <el-input v-model="form.delFlag" placeholder="请输入删除标志" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listPrice, getPrice, delPrice, addPrice, updatePrice ,mdPriceOrderSync} from "@/api/mes/md/purcInboundPrice";

export default {
  name: "Price",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 采购订单实际入库价格数据流表格数据
      priceList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        cgjgId: null,        orderDate: null,        orderCode: null,        purchaseRequirement: null,        materialCode: null,        materialName: null,        materialType: null,        materialAttribute: null,        specificationModel: null,        purchaseUnitPrice: null,        inboundQuantity: null,        purchaseRequirementQty: null,        unit: null,        invoiceAmount: null,        taxAmount: null,        freightCost: null,        purchaseRequirementAmt: null,        actualPayableAmount: null,        paidAmount: null,        returnQuantity: null,        refundAmount: null,        itemsPerBox: null,        unitConversionRate: null,        purchaseUnits: null,        purchaseUnit: null,        remarks: null,        minUnitPriceMlG: null,        unit2: null,        supplierCode: null,        supplierName: null,        paymentStatus: null,        inboundTime: null,        returnRefundTime: null,        status: null,      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询采购订单实际入库价格数据流列表 */
    getList() {
      this.loading = true;
      listPrice(this.queryParams).then(response => {
        this.priceList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,        cgjgId: null,        orderDate: null,        orderCode: null,        purchaseRequirement: null,        materialCode: null,        materialName: null,        materialType: null,        materialAttribute: null,        specificationModel: null,        purchaseUnitPrice: null,        inboundQuantity: null,        purchaseRequirementQty: null,        unit: null,        invoiceAmount: null,        taxAmount: null,        freightCost: null,        purchaseRequirementAmt: null,        actualPayableAmount: null,        paidAmount: null,        returnQuantity: null,        refundAmount: null,        itemsPerBox: null,        unitConversionRate: null,        purchaseUnits: null,        purchaseUnit: null,        remarks: null,        minUnitPriceMlG: null,        unit2: null,        supplierCode: null,        supplierName: null,        paymentStatus: "0",        inboundTime: null,        returnRefundTime: null,        status: "0",        delFlag: null,        createBy: null,        createTime: null,        updateBy: null,        updateTime: null      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加采购订单实际入库价格数据流";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getPrice(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改采购订单实际入库价格数据流";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updatePrice(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addPrice(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    handleSync() {
      if (this.loading) {
        this.$modal.message("正常进行中，请不要重复点击...");
        return;
      }
      this.loading = true;
      this.$modal.confirm('是否确认同步数据？').then(() => {
        mdPriceOrderSync().then(response => {
          if (response.code === 200) {
            this.$modal.msgSuccess("同步成功");
            this.getList();
          } else {
            this.$modal.msgError("同步失败");
          }
        }).catch(() => {
          this.$modal.msgError("同步失败");
        }).finally(() => {
          this.loading = false;
        });
      }).catch(() => {
        this.loading = false;
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除采购订单实际入库价格数据流编号为"' + ids + '"的数据项？').then(function() {
        return delPrice(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('md/price/export', {
        ...this.queryParams
      }, `price_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
